<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
  <head>
    <title>待授权区</title>
<style type="text/css">
<!--
body,td,th {
	padding:0px;
	height:100%;
	font-size:12px;
	overflow:auto;
}
-->
</style>   
  </head>
  <jsp:include page="../common/init.jsp"></jsp:include>
  <%
 response.setHeader("Pragma", "No-cache");
 response.setHeader("Cache-Control", "no-cache");
 response.setDateHeader("Expires", 0);
%>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/qxgl.js"></script>
<script language="javaScript" src="<%=request.getContextPath()%>/js/menu.js"></script>
<script type="text/javascript">
	//删除待授区选中用户、用户组
	var flag = 0;
	function delrole()         
	{         
		for(i=0;i<rightForm.yhbhs.length;i++)         
		{         
			if(rightForm.yhbhs.options[i].selected==true)
			{
			  flag=1;
			  break;
			}                  
		}
		if(flag==1)
		{
			for(j=i+1;j<rightForm.yhbhs.length;j++)         
			{         
				rightForm.yhbhs.options[j-1].text = rightForm.yhbhs.options[j].text;
				rightForm.yhbhs.options[j-1].value = rightForm.yhbhs.options[j].value;         
			}         
			rightForm.yhbhs.length = rightForm.yhbhs.length - 1;
		}
		else
		{
			alert("请选中要删除的用户组！");
			return ;
		}                 
	}
	//全部删除待授区用户、用户组
	function delAll()
	{
		rightForm.yhbhs.length=0;
	}  
	//授权          
	function adduserrole()         
	{         
		var yhbhs="";
		for(i=0;i<rightForm.yhbhs.length;i++)         
		{         
			rightForm.yhbhs.options[i].selected = true;
			if(i==rightForm.yhbhs.length-1)
			{
				yhbhs+=rightForm.yhbhs.options[i].value;
			}
			else
			{
				yhbhs+=rightForm.yhbhs.options[i].value+",";
			}
			
		}
		if(i<1)
		{
			alert("请添加要授权的用户组!");
			return false;
		}
		else
		{
			popPage("<%=request.getContextPath()%>/qxgl/createXmlTree.do?yhzbh="+yhbhs,650,750); 
			rightForm.yhbhs.length=0;
		}      
	} 
	
	mpmenu1=new mMenu('清除','delAll()','script','<%=request.getContextPath() %>/images/img_ht_wz_8.gif','62','24','2','100','2');
	mpmenu2=new mMenu('授权','adduserrole()','script','<%=request.getContextPath() %>/images/img_ht_wz_8.gif','62','24','2','100','2');
</script>
  <body bgcolor="#F2F2F2" topmargin="0" leftmargin="0" bottommargin="0" rightmargin="0">
  <form name="rightForm">
   	<table border="0" width="150" cellpadding="0" cellspacing="0"  class="table">
   	<tr>
   		<td height="30">&nbsp;
   		</td>
   	</tr>
   	 <tr>
   	 <td align="left">
   	 待授权用户组:
   	 </td>
   	 </tr>
   	<tr >
   	 <td align="center" width="160">
   	   <select name="yhbhs" size="20" multiple="multiple" style="width:160px;">
		</select>
   	</td>
   	</tr>
   	<tr>
   	<td align="center" >
  		<div id="funbut">
		<SCRIPT>document.write(mwritetodocument());</SCRIPT>
		</div>
   	</td>
   	</tr>
   	</table>
   		</form>
  </body>
</html>
